﻿@using Sharp.DataTransferObject
@using Sharp.Infrastructure.WebApiClient
@using Sharp.ServiceContracts
@using Sharp.WebBooter.Areas.Platform.Controllers

@{
    List<OrgIndexViewModel> newOrgList = new List<OrgIndexViewModel>();
    IEnumerable<OrgDTO> list;

    using (var proxy = new WebApiClientServiceProxy<IEnterpriseService>())
    {
        list = proxy.Channel.GetOrgs().Result;
    }

    OrgController.Build(list, newOrgList, null);
}



<div class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <script>
                function treeclick(obj, orgId) {
                    var $Searchform = $(obj).parents('.modal-body').find(".SearchArea form");

                    var orgIds = new Array();

                    var $c = $Searchform.find("input[name='OrgId']");
                    if ($c.length === 0) {
                        $c = $Searchform.find("input[data-original='OrgId']");
                    }
                    $c.val("");
                    $Searchform.find("input[clone='1']").remove();
                    $("#orgWindowTreeDataList .checkColumn input[name='cellCheckbox']:checked").each(function (index, item) {
                        if (item.checked) {
                            if (index === 0) {
                                $c.val(item.value);
                            } else {

                                $Searchform.append($c.clone().attr("clone", 1).val(item.value));
                            }
                            orgIds.push(item.value);
                        }
                    });

                    $Searchform.find("button").click();
                }

         
            </script>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">@ViewBag.Title</h4>
            </div>
            <div class="modal-body no-pad-top">
                <div class="row">
                    <div class="col-sm-3">
                        <div class="box box-solid">
                            <div class="box-body no-padding" style="overflow-y: scroll; max-height: 500px;">
                                <table id="orgWindowTreeDataList" class="table table-bordered table-condensed table-striped table-hover">
                                    <thead>
                                    <tr>
                                        <th style="width: 43px;" class="center"></th>
                                        <th style="width: 240px;">名称</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @foreach (var item in newOrgList)
                                    {
                                        <tr class="@item.Itemclass">
                                            <td style="width: 43px; padding: 1px;" class="center checkColumn"><label><input type="checkbox" name="cellCheckbox" value="@item.Id" onclick="treeclick(this, '@item.Id')"/><i></i></label></td>
                                            <td style="padding: 1px;">
                                                @item.Title
                                            </td>
                                        </tr>
                                    }
                                    </tbody>
                                </table>
                                <script>
                                    $('#orgWindowTreeDataList').treegrid({
                                        treeColumn: 1,
                                        expandAll: false //是否全部展开
                                    });
                                </script>

                            </div>
                        </div>

                    </div>
                    <!-- /.col -->
                    <div class="col-sm-9 no-padding">
                        @RenderSection("tabContent", required: true)
                    </div>
                </div>
            </div>
            @*<div class="modal-footer no-pad-top">
                <div class="btn-group">
                    @Html.Bootstrap().LinkButton("确定", ToolBarIco.Save).Style(BootstrapStyle.Primary).Click("new windowLayoutViewModel().saveForm(event)").Attribute("data-dismiss", "modal")

                    @Html.Bootstrap().LinkButton("关闭", ToolBarIco.Close).Style(BootstrapStyle.Default).Attribute("data-dismiss", "modal")
                </div>
            </div>*@
            @RenderSection("windowfooter",false)
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>